﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.OleDb;
using GrayMatterSoft;
using System.Text;


public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string deger = deger = Request.QueryString["sayfa"];
        if (deger == "kasko")
        {
            Panel1.Visible = true;
            Panel2.Visible = false;
            Panel3.Visible = false;
            //Panel4.Visible = false;
            Panel5.Visible = false;
            Panel6.Visible = false;
        }
        if (deger == "saglik")
        {
            Panel1.Visible = false;
            Panel2.Visible = true;
            Panel3.Visible = false;
            //Panel4.Visible = false;
            Panel5.Visible = false;
            Panel6.Visible = false;
        }

        if (deger == "konut")
        {
            Panel1.Visible = false;
            Panel2.Visible = false;
            Panel3.Visible = true;
            //Panel4.Visible = false;
            Panel5.Visible = false;
            Panel6.Visible = false;
        }

        if (deger == "istf")
        {
            Panel1.Visible = false;
            Panel2.Visible = false;
            Panel3.Visible = false;
            //Panel4.Visible = true;
            Panel5.Visible = false;
            Panel6.Visible = false;
        }

        if (deger == "dask")
        {
            Panel1.Visible = false;
            Panel2.Visible = false;
            Panel3.Visible = false;
            //Panel4.Visible = false;
            Panel5.Visible = true;
            Panel6.Visible = false;

        }
        if (deger == "policezaman")
        {
            Panel1.Visible = false;
            Panel2.Visible = false;
            Panel3.Visible = false;
            //Panel4.Visible = false;
            Panel5.Visible = false;
            Panel6.Visible = true;

        }

    }
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        //sqlacs.InsertParameters.Add("tekliftarihi", DateTimeKind.Local.ToString());

    }
    protected void FormView1_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {




        TextBox tckimlikno = FormView1.FindControl("tckimliknoTextBox") as TextBox;
        OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["acsbagla"].ConnectionString);
        OleDbCommand komutsec = new OleDbCommand("select * from tblmusteri where tckimlikno='" + tckimlikno.Text.ToString() + "'", con);


        if (con.State == ConnectionState.Closed)
            con.Open();
        OleDbDataReader oku = komutsec.ExecuteReader();


        while (oku.Read())
        {
            Session.Add("UID", Convert.ToInt32(oku[0].ToString()));

        }
        con.Close();

        if (con.State == ConnectionState.Closed)
        {
            con.Open();
        }

        DropDownList markasi = FormView1.FindControl("DropDownList1") as DropDownList;
        TextBox modeli = FormView1.FindControl("modeli") as TextBox;
        DropDownList modelyil = FormView1.FindControl("dolduryil") as DropDownList;
        DropDownList ikmil = FormView1.FindControl("DropDownList2") as DropDownList;
        DropDownList plakail = FormView1.FindControl("DropDownList3") as DropDownList;
        RadioButtonList ksekli = FormView1.FindControl("RadioButtonList1") as RadioButtonList;
        TextBox plakano = FormView1.FindControl("plakano") as TextBox;

        TextBox oacente = FormView1.FindControl("oacente") as TextBox;
        TextBox opoliceno = FormView1.FindControl("opoliceno") as TextBox;
        GMDatePicker obaslangictarihi = FormView1.FindControl("GMDatePicker2") as GMDatePicker;
        GMDatePicker obitistarihi = FormView1.FindControl("GMDatePicker3") as GMDatePicker;
        TextBox oyenilemeno = FormView1.FindControl("oyenilemeno") as TextBox;
TextBox meslek = FormView1.FindControl("meslek") as TextBox;
        DropDownList hsrsind = FormView1.FindControl("DropDownList4") as DropDownList;
        RadioButtonList mslkind = FormView1.FindControl("RadioButtonList6") as RadioButtonList;



        //RadioButtonList odemetip = FormView1.FindControl("RadioButtonList2") as RadioButtonList;
        //DropDownList odemetaksit = FormView1.FindControl("odemetaksit") as DropDownList;


        OleDbCommand uygula = new OleDbCommand("insert into tblkasko(userid,kveyat,plakano,aracmarka,aracmodel,modelyil,ikametil,plakail,ksekli,oacente,opoliceno,obaslangictarihi,obitistarihi,oyenilemeno,hsrsizind,meslkind,meslek) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", con);
        uygula.Parameters.Add("userid", System.Data.OleDb.OleDbType.Integer).Value = Session.Contents["UID"].ToString();

        string degertip = Request.QueryString["stip"];
        if (degertip == "k")
        {
            uygula.Parameters.Add("kveyat", System.Data.OleDb.OleDbType.VarChar).Value = "Kasko";

        }

        if (degertip == "t")
        {
            uygula.Parameters.Add("kveyat", System.Data.OleDb.OleDbType.VarChar).Value = "Trafik";

        }

        uygula.Parameters.Add("plakano", System.Data.OleDb.OleDbType.VarChar).Value = plakano.Text.ToString();
        uygula.Parameters.Add("aracmarka", System.Data.OleDb.OleDbType.VarChar).Value = markasi.Text.ToString();

        uygula.Parameters.Add("aracmodel", System.Data.OleDb.OleDbType.VarChar).Value = modeli.Text.ToString();
        uygula.Parameters.Add("modelyil", System.Data.OleDb.OleDbType.VarChar).Value = modelyil.Text.ToString();
        uygula.Parameters.Add("ikametil", System.Data.OleDb.OleDbType.VarChar).Value = ikmil.Text.ToString();
        uygula.Parameters.Add("plakail", System.Data.OleDb.OleDbType.VarChar).Value = plakail.Text.ToString();
        uygula.Parameters.Add("ksekli", System.Data.OleDb.OleDbType.VarChar).Value = ksekli.Text.ToString();
        uygula.Parameters.Add("oacente", System.Data.OleDb.OleDbType.VarChar).Value = oacente.Text.ToString();
        uygula.Parameters.Add("opoliceno", System.Data.OleDb.OleDbType.VarChar).Value = opoliceno.Text.ToString();
        uygula.Parameters.Add("obaslangictarihi", System.Data.OleDb.OleDbType.Date).Value = obaslangictarihi.Date.ToShortDateString();
        uygula.Parameters.Add("obitistarihi", System.Data.OleDb.OleDbType.Date).Value = obitistarihi.Date.ToShortDateString();
        uygula.Parameters.Add("oyenilemeno", System.Data.OleDb.OleDbType.VarChar).Value = oyenilemeno.Text.ToString();
        uygula.Parameters.Add("hsrsizind", System.Data.OleDb.OleDbType.VarChar).Value = hsrsind.Text.ToString();
        uygula.Parameters.Add("meslkind", System.Data.OleDb.OleDbType.VarChar).Value = mslkind.Text.ToString();
        uygula.Parameters.Add("meslek", System.Data.OleDb.OleDbType.VarChar).Value = meslek.Text.ToString();





        
        


        
        
        //uygula.Parameters.Add("odemetip", System.Data.OleDb.OleDbType.VarChar).Value = odemetip.Text.ToString();

        
        //RadioButtonList odemetipi = FormView1.FindControl("RadioButtonList2") as RadioButtonList;

        //if (odemetipi.SelectedIndex == 0)
        //{
        //    uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = 0;
        //}
        //if (odemetipi.SelectedIndex == 1)
        //{
        //    uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = odemetaksit.Text.ToString();
        //}

        



        uygula.ExecuteNonQuery();
        con.Close();


        Response.Redirect("sayfagoster.aspx?sayfa=kasko&MID=" + Session.Contents["UID"]);


    }

    private TypeCode DateTime()
    {
        throw new NotImplementedException();
    }

    protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
    {

    }
    protected void FormView1_ItemUpdated(object sender, FormViewUpdatedEventArgs e)
    {

    }
    protected void FormView1_ItemCreated(object sender, EventArgs e)
    {

    }
    protected void FormView1_ItemCommand(object sender, FormViewCommandEventArgs e)
    {
        //if (e.CommandName == "Insert")
        //{

        //}
    }
    Label labelkurum = new Label();
    Label label1 = new Label();
    protected void FormView1_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            DropDownList dolduryil = FormView1.FindControl("dolduryil") as DropDownList;
            dolduryil.Items.Add(" Yıl Seçiniz");



            for (int i = 1997; i < 2011; i++)
            {


                if (i == 1997)
                {
                    dolduryil = FormView1.FindControl("dolduryil") as DropDownList;
                    dolduryil.Items.Add(i.ToString() + " ve öncesi");

                }
                else
                {
                    dolduryil = FormView1.FindControl("dolduryil") as DropDownList;
                    dolduryil.Items.Add(i.ToString());
                }


            }


        }


        string degertip = Request.QueryString["stip"];
        if (degertip == "k")
        {
          label1 = FormView1.FindControl("label1") as Label;
            label1.Text = "KASKO";
        }

        if (degertip == "t")
        {
            label1 = FormView1.FindControl("label1") as Label;
            label1.Text = "TRAFİK";
        }


       

        DropDownList ikmil = FormView1.FindControl("DropDownList2") as DropDownList;
        ikmil.Items.Insert(0, "Lütfen Seçiniz");
        DropDownList plakail = FormView1.FindControl("DropDownList3") as DropDownList;
        plakail.Items.Insert(0, "Lütfen Seçiniz");



    }
    protected void InsertButton_Click1(object sender, EventArgs e)
    {

    }
    protected void FormView2_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {
        TextBox tckimlikno = FormView2.FindControl("tckimliknoTextBox") as TextBox;
        OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["acsbagla"].ConnectionString);
        OleDbCommand komutsec = new OleDbCommand("select * from tblmusteri where tckimlikno='" + tckimlikno.Text.ToString() + "'", con);


        if (con.State == ConnectionState.Closed)
            con.Open();
        OleDbDataReader oku = komutsec.ExecuteReader();


        while (oku.Read())
        {
            Session.Add("UID", Convert.ToInt32(oku[0].ToString()));

        }
        con.Close();

        if (con.State == ConnectionState.Closed)
        {
            con.Open();
        }


        GMDatePicker dogumtarihi = FormView2.FindControl("GMDatePicker1") as GMDatePicker;
        
        //TextBox kangrubu = FormView2.FindControl("kangrubu") as TextBox;
        //TextBox boy = FormView2.FindControl("boy") as TextBox;
        //TextBox kilo = FormView2.FindControl("kilo") as TextBox;

        //DropDownList odemetaksiti = FormView2.FindControl("odemetaksit2") as DropDownList;
        //RadioButtonList odemetip = FormView2.FindControl("RadioButtonList4") as RadioButtonList;
        OleDbCommand uygula = new OleDbCommand("insert into tblsaglik(userid,cinsiyet,dogumtarihi) values(?,?,?)", con);
        uygula.Parameters.Add("userid", System.Data.OleDb.OleDbType.Integer).Value = Session.Contents["UID"].ToString();
       

        RadioButtonList cinsiyeti = FormView2.FindControl("RadioButtonList3") as RadioButtonList;
        if (cinsiyeti.SelectedIndex == 0)
        {
            uygula.Parameters.Add("cinsiyet", System.Data.OleDb.OleDbType.VarChar).Value = cinsiyeti.Text.ToString();
        }
        if (cinsiyeti.SelectedIndex == 1)
        {
            uygula.Parameters.Add("cinsiyet", System.Data.OleDb.OleDbType.VarChar).Value = cinsiyeti.Text.ToString();
        }




        uygula.Parameters.Add("dogumtarihi", System.Data.OleDb.OleDbType.Date).Value = dogumtarihi.Date.ToShortDateString();

        //uygula.Parameters.Add("kangrubu", System.Data.OleDb.OleDbType.VarChar).Value = kangrubu.Text.ToString();

        //uygula.Parameters.Add("boy", System.Data.OleDb.OleDbType.VarChar).Value = boy.Text.ToString();
        //uygula.Parameters.Add("kilo", System.Data.OleDb.OleDbType.VarChar).Value = kilo.Text.ToString();


        //uygula.Parameters.Add("odemetip", System.Data.OleDb.OleDbType.VarChar).Value = "Peşin";
        //uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = 2;
        
        //uygula.Parameters.Add("odemetip", System.Data.OleDb.OleDbType.VarChar).Value = odemetip.Text.ToString();


        //RadioButtonList odemetipisaglik = FormView2.FindControl("RadioButtonList4") as RadioButtonList;

        //if (odemetipisaglik.SelectedIndex == 0)
        //{
        //    uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = 0;
        //}
        //if (odemetipisaglik.SelectedIndex == 1)
        //{
        //    uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = odemetaksiti.Text.ToString();
        //}





        uygula.ExecuteNonQuery();
        con.Close();
        Response.Redirect("sayfagoster.aspx?sayfa=saglik&MID=" + Session.Contents["UID"]);
    }
    protected void FormView2_Load(object sender, EventArgs e)
    {

       
    }
    protected void FormView3_Load(object sender, EventArgs e)
    {
       
    }
    protected void FormView3_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {
        TextBox tckimlikno = FormView3.FindControl("tckimliknoTextBox") as TextBox;
        OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["acsbagla"].ConnectionString);
        OleDbCommand komutsec = new OleDbCommand("select * from tblmusteri where tckimlikno='" + tckimlikno.Text.ToString() + "'", con);


        if (con.State == ConnectionState.Closed)
            con.Open();
        OleDbDataReader oku = komutsec.ExecuteReader();


        while (oku.Read())
        {
            Session.Add("UID", Convert.ToInt32(oku[0].ToString()));

        }
        con.Close();

        if (con.State == ConnectionState.Closed)
        {
            con.Open();
        }

      
        TextBox konutilce = FormView3.FindControl("konutilce") as TextBox;
        TextBox binabedeli = FormView3.FindControl("binabedeli") as TextBox;
        TextBox esyabedeli = FormView3.FindControl("esyabedeli") as TextBox;
        TextBox cambedeli = FormView3.FindControl("cambedeli") as TextBox;
        TextBox daskpoliceno = FormView3.FindControl("daskpoliceno") as TextBox;
        GMDatePicker daskbitistarihi = FormView3.FindControl("GMDatePicker4") as GMDatePicker;
        TextBox daskbedeli = FormView3.FindControl("daskbedeli") as TextBox;
        CheckBoxList guvenlik = FormView3.FindControl("CheckBoxList1") as CheckBoxList;
        RadioButtonList konutyapi = FormView3.FindControl("konutyapi") as RadioButtonList;
       
        DropDownList konutill = FormView3.FindControl("DropDownListil") as DropDownList;
        //DropDownList odemetaksit = FormView3.FindControl("odemetaksit3") as DropDownList;
        //RadioButtonList odemetip = FormView3.FindControl("RadioButtonList5") as RadioButtonList;
        OleDbCommand uygula = new OleDbCommand("insert into tblkonut(userid,konutil,konutilce,konutyapi,binabedeli,esyabedeli,cambedeli,daskpoliceno,daskbitistarihi,daskbedeli,guvenlik) values(?,?,?,?,?,?,?,?,?,?,?)", con);
        uygula.Parameters.Add("userid", System.Data.OleDb.OleDbType.Integer).Value = Session.Contents["UID"].ToString();
        uygula.Parameters.Add("konutil", System.Data.OleDb.OleDbType.VarChar).Value = konutill.Text.ToString();
        uygula.Parameters.Add("konutilce", System.Data.OleDb.OleDbType.VarChar).Value = konutilce.Text.ToString();
        uygula.Parameters.Add("konutyapi", System.Data.OleDb.OleDbType.VarChar).Value = konutyapi.Text.ToString();
        uygula.Parameters.Add("binabedeli", System.Data.OleDb.OleDbType.VarChar).Value = binabedeli.Text.ToString();
        uygula.Parameters.Add("esyabedeli", System.Data.OleDb.OleDbType.VarChar).Value = esyabedeli.Text.ToString();
        uygula.Parameters.Add("cambedeli", System.Data.OleDb.OleDbType.VarChar).Value = cambedeli.Text.ToString();
        uygula.Parameters.Add("daskpoliceno", System.Data.OleDb.OleDbType.VarChar).Value = daskpoliceno.Text.ToString();
        uygula.Parameters.Add("daskbitistarihi", System.Data.OleDb.OleDbType.Date).Value = daskbitistarihi.Date.ToShortDateString();
        uygula.Parameters.Add("daskbedeli", System.Data.OleDb.OleDbType.VarChar).Value = daskbedeli.Text.ToString();

        StringBuilder sb = new StringBuilder();
        foreach (ListItem satir in guvenlik.Items)
        {
            if (satir.Selected==true)
            {
                sb.Append(string.Format("{0}",satir.Text.ToString()));

                
 
            }
            
        }

       uygula.Parameters.Add("guvenlik", System.Data.OleDb.OleDbType.VarChar).Value =sb.ToString();

            
       


       
        //uygula.Parameters.Add("odemetip", System.Data.OleDb.OleDbType.VarChar).Value = odemetip.Text.ToString();


        //RadioButtonList odemetipi = FormView3.FindControl("RadioButtonList5") as RadioButtonList;

        //if (odemetipi.SelectedIndex == 0)
        //{
        //    uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = 0;
        //}
        //if (odemetipi.SelectedIndex == 1)
        //{
        //    uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = odemetaksit.Text.ToString();
        //}



        uygula.ExecuteNonQuery();
        con.Close();
        Response.Redirect("sayfagoster.aspx?sayfa=konut&MID=" + Session.Contents["UID"]);
    }



    protected void RadioButton5_CheckedChanged(object sender, EventArgs e)
    {



    }
    protected void RadioButton4_CheckedChanged(object sender, EventArgs e)
    {


    }
    protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void RadioButtonList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        RadioButtonList odemetipi = FormView1.FindControl("RadioButtonList2") as RadioButtonList;

        if (odemetipi.SelectedIndex == 0)
        {
            DropDownList odemetaksit = FormView1.FindControl("odemetaksit") as DropDownList;
            odemetaksit.Visible = false;
        }
        if (odemetipi.SelectedIndex == 1)
        {
            DropDownList odemetaksit = FormView1.FindControl("odemetaksit") as DropDownList;
            odemetaksit.Items.Clear();

            for (int i = 1; i < 25; i++)
            {
                odemetaksit.Items.Add(i.ToString());
            }

            odemetaksit.Visible = true;
        }


    }

    protected void odemetipii_SelectedIndexChanged(object sender, EventArgs e)
    {

        //RadioButtonList odemetipi = FormView2.FindControl("odemetipii") as RadioButtonList;

        //if (odemetipi.SelectedIndex == 0)
        //{
        //    DropDownList odemetaksit = FormView2.FindControl("odemetaksit2") as DropDownList;
        //    odemetaksit.Visible = false;
        //}
        //if (odemetipi.SelectedIndex == 1)
        //{
        //    DropDownList odemetaksit = FormView2.FindControl("odemetaksit2") as DropDownList;
        //    odemetaksit.Items.Clear();

        //    for (int i = 1; i < 25; i++)
        //    {
        //        odemetaksit.Items.Add(i.ToString());
        //    }

        //    odemetaksit.Visible = true;
        //}



    }
    protected void odemetaksit2_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void RadioButtonList4_SelectedIndexChanged(object sender, EventArgs e)
    {
        RadioButtonList odemetipsaglik = FormView2.FindControl("RadioButtonList4") as RadioButtonList;

        if (odemetipsaglik.SelectedIndex == 0)
        {
            DropDownList odemetaksitsaglik = FormView2.FindControl("odemetaksit2") as DropDownList;
            odemetaksitsaglik.Visible = false;
        }
        if (odemetipsaglik.SelectedIndex == 1)
        {
            DropDownList odemetaksitsaglik = FormView2.FindControl("odemetaksit2") as DropDownList;
            odemetaksitsaglik.Items.Clear();

            for (int i = 1; i < 25; i++)
            {
                odemetaksitsaglik.Items.Add(i.ToString());
            }

            odemetaksitsaglik.Visible = true;

        }
    }
    protected void odemetaksit3_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void RadioButtonList5_SelectedIndexChanged(object sender, EventArgs e)
    {

        RadioButtonList odemetipkonut = FormView3.FindControl("RadioButtonList5") as RadioButtonList;

        if (odemetipkonut.SelectedIndex == 0)
        {
            DropDownList odemetaksitkonut = FormView3.FindControl("odemetaksit3") as DropDownList;
            odemetaksitkonut.Visible = false;
        }
        if (odemetipkonut.SelectedIndex == 1)
        {
            DropDownList odemetaksitkonut = FormView3.FindControl("odemetaksit3") as DropDownList;
            odemetaksitkonut.Items.Clear();

            for (int i = 1; i < 25; i++)
            {
                odemetaksitkonut.Items.Add(i.ToString());
            }

            odemetaksitkonut.Visible = true;

        }

    }
    protected void dogumtarihi_TextChanged(object sender, EventArgs e)
    {
       
    }
    protected void dogumtarihi_Init(object sender, EventArgs e)
    {
    
    }
    protected void dogumtarihi_Load(object sender, EventArgs e)
    {
        


       
    }
    protected void dogumtarihi_PreRender(object sender, EventArgs e)
    {
       
    }
    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        
    }
    protected void FormView4_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {

       // TextBox tckimlikno = FormView4.FindControl("tckimliknoTextBox") as TextBox;
       // OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["acsbagla"].ConnectionString);
       // OleDbCommand komutsec = new OleDbCommand("select * from tblmusteri where tckimlikno='" + tckimlikno.Text.ToString() + "'", con);


       // if (con.State == ConnectionState.Closed)
       //     con.Open();
       // OleDbDataReader oku = komutsec.ExecuteReader();


       // while (oku.Read())
       // {
       //     Session.Add("UID", Convert.ToInt32(oku[0].ToString()));

       // }
       // con.Close();

       // if (con.State == ConnectionState.Closed)
       // {
       //     con.Open();
       // }

       // DropDownList konutill = FormView4.FindControl("DropDownListil") as DropDownList;
       // TextBox konutilce = FormView4.FindControl("konutilce") as TextBox;
       // RadioButtonList konutyapi = FormView4.FindControl("konutyapi") as RadioButtonList;
       // TextBox binabedeli = FormView4.FindControl("binabedeli") as TextBox;
       // TextBox emtiabedeli = FormView4.FindControl("emtiabedeli") as TextBox;
       // TextBox makinebedeli = FormView4.FindControl("makinebedeli") as TextBox;
        // TextBox demirbasbedeli = FormView4.FindControl("demirbasbedeli") as TextBox;
       // TextBox cambedeli = FormView4.FindControl("cambedeli") as TextBox;
       // TextBox faaliyetalani = FormView4.FindControl("faaliyetalani") as TextBox;
       // CheckBoxList guvenlik = FormView4.FindControl("CheckBoxList1") as CheckBoxList;
       

       //RadioButtonList odemetip = FormView4.FindControl("RadioButtonList5") as RadioButtonList;
       // DropDownList odemetaksit = FormView4.FindControl("odemetaksit3") as DropDownList;

       // OleDbCommand uygula = new OleDbCommand("insert into tblistf(userid,konutil,konutilce,konutyapi,binabedeli,emtiabedeli,makinebedeli,demirbasbedeli,cambedeli,faaliyetalani,guvenlik,odemetip,odemetaksit) values(?,?,?,?,?,?,?,?,?,?,?,?,?)", con);
       // uygula.Parameters.Add("userid", System.Data.OleDb.OleDbType.Integer).Value = Session.Contents["UID"].ToString();
       // uygula.Parameters.Add("konutil", System.Data.OleDb.OleDbType.VarChar).Value = konutill.Text.ToString();
       // uygula.Parameters.Add("konutilce", System.Data.OleDb.OleDbType.VarChar).Value = konutilce.Text.ToString();
       // uygula.Parameters.Add("konutyapi", System.Data.OleDb.OleDbType.VarChar).Value = konutyapi.Text.ToString();
       // uygula.Parameters.Add("binabedeli", System.Data.OleDb.OleDbType.VarChar).Value = binabedeli.Text.ToString();
       // uygula.Parameters.Add("emtiabedeli", System.Data.OleDb.OleDbType.VarChar).Value = emtiabedeli.Text.ToString();
       // uygula.Parameters.Add("makinebedeli", System.Data.OleDb.OleDbType.VarChar).Value = makinebedeli.Text.ToString();
       // uygula.Parameters.Add("demirbasbedeli", System.Data.OleDb.OleDbType.VarChar).Value = demirbasbedeli.Text.ToString();
       // uygula.Parameters.Add("cambedeli", System.Data.OleDb.OleDbType.VarChar).Value = cambedeli.Text.ToString();
       // uygula.Parameters.Add("faaliyetalani", System.Data.OleDb.OleDbType.VarChar).Value = faaliyetalani.Text.ToString();
       // uygula.Parameters.Add("guvenlik", System.Data.OleDb.OleDbType.VarChar).Value = guvenlik.Text.ToString();
       // uygula.Parameters.Add("odemetip", System.Data.OleDb.OleDbType.VarChar).Value = odemetip.Text.ToString();


       // RadioButtonList odemetipi = FormView4.FindControl("RadioButtonList5") as RadioButtonList;

       // if (odemetipi.SelectedIndex == 0)
       // {
       //     uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = 0;
       // }
       // if (odemetipi.SelectedIndex == 1)
       // {
       //     uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = odemetaksit.Text.ToString();
       // }



       // uygula.ExecuteNonQuery();
       // con.Close();
       // Response.Redirect("sayfagoster.aspx?sayfa=istf&MID=" + Session.Contents["UID"]);


    }
    protected void FormView5_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {

        TextBox tckimlikno = FormView5.FindControl("tckimliknoTextBox") as TextBox;
        OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["acsbagla"].ConnectionString);
        OleDbCommand komutsec = new OleDbCommand("select * from tblmusteri where tckimlikno='" + tckimlikno.Text.ToString() + "'", con);


        if (con.State == ConnectionState.Closed)
            con.Open();
        OleDbDataReader oku = komutsec.ExecuteReader();


        while (oku.Read())
        {
            Session.Add("UID", Convert.ToInt32(oku[0].ToString()));

        }
        con.Close();

        if (con.State == ConnectionState.Closed)
        {
            con.Open();
        }

        DropDownList daskil = FormView5.FindControl("DropDownListil") as DropDownList;
        TextBox konutilce = FormView5.FindControl("konutilce") as TextBox;

        TextBox daskmahalle = FormView5.FindControl("daskmahalle") as TextBox;
        TextBox daskSemt = FormView5.FindControl("daskSemt") as TextBox;
        TextBox daskCadde = FormView5.FindControl("daskCadde") as TextBox;
        TextBox dasksokak = FormView5.FindControl("dasksokak") as TextBox;
        TextBox daskaptradi = FormView5.FindControl("daskaptradi") as TextBox;
        TextBox daskbinakapino = FormView5.FindControl("daskbinakapino") as TextBox;
        TextBox daskdaireno = FormView5.FindControl("daskdaireno") as TextBox;
        TextBox daskkatno = FormView5.FindControl("daskkatno") as TextBox;
        TextBox pafta = FormView5.FindControl("pafta") as TextBox;
        TextBox parsel = FormView5.FindControl("parsel") as TextBox;
        TextBox Ada = FormView5.FindControl("Ada") as TextBox;
        TextBox SayfaNo = FormView5.FindControl("SayfaNo") as TextBox;
        TextBox dyuzolcumu = FormView5.FindControl("dyuzolcumu") as TextBox;

        RadioButtonList odemetip = FormView5.FindControl("RadioButtonList5") as RadioButtonList;
        DropDownList odemetaksit = FormView5.FindControl("odemetaksit3") as DropDownList;

        OleDbCommand uygula = new OleDbCommand("insert into tbldask(userid,daskil,daskilce,daskmahalle,daskSemt,daskCadde,dasksokak,daskaptradi,daskbinakapino,daskdaireno,daskkatno,pafta,parsel,ada,SayfaNo,dyuzolcumu,odemetip,odemetaksit) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", con);
        uygula.Parameters.Add("userid", System.Data.OleDb.OleDbType.Integer).Value = Session.Contents["UID"].ToString();
        uygula.Parameters.Add("daskil", System.Data.OleDb.OleDbType.VarChar).Value = daskil.Text.ToString();
        uygula.Parameters.Add("daskilce", System.Data.OleDb.OleDbType.VarChar).Value = konutilce.Text.ToString();
        uygula.Parameters.Add("daskmahalle", System.Data.OleDb.OleDbType.VarChar).Value = daskmahalle.Text.ToString();
        uygula.Parameters.Add("daskSemt", System.Data.OleDb.OleDbType.VarChar).Value =daskSemt.Text.ToString();
        uygula.Parameters.Add("daskCadde", System.Data.OleDb.OleDbType.VarChar).Value = daskCadde.Text.ToString();
        uygula.Parameters.Add("dasksokak", System.Data.OleDb.OleDbType.VarChar).Value = dasksokak.Text.ToString();
        uygula.Parameters.Add("daskaptradi", System.Data.OleDb.OleDbType.VarChar).Value =daskaptradi.Text.ToString();
        uygula.Parameters.Add("daskbinakapino", System.Data.OleDb.OleDbType.VarChar).Value = daskbinakapino.Text.ToString();
        uygula.Parameters.Add("daskdaireno", System.Data.OleDb.OleDbType.VarChar).Value = daskdaireno.Text.ToString();
        uygula.Parameters.Add("daskkatno", System.Data.OleDb.OleDbType.VarChar).Value = daskkatno.Text.ToString();
        uygula.Parameters.Add("pafta", System.Data.OleDb.OleDbType.VarChar).Value = pafta.Text.ToString();
        uygula.Parameters.Add("parsel", System.Data.OleDb.OleDbType.VarChar).Value = parsel.Text.ToString();
        uygula.Parameters.Add("ada", System.Data.OleDb.OleDbType.VarChar).Value = Ada.Text.ToString();
        uygula.Parameters.Add("SayfaNo", System.Data.OleDb.OleDbType.VarChar).Value = SayfaNo.Text.ToString();
        uygula.Parameters.Add("dyuzolcumu", System.Data.OleDb.OleDbType.VarChar).Value = dyuzolcumu.Text.ToString();

        uygula.Parameters.Add("odemetip", System.Data.OleDb.OleDbType.VarChar).Value = odemetip.Text.ToString();


        RadioButtonList odemetipi = FormView5.FindControl("RadioButtonList5") as RadioButtonList;

        if (odemetipi.SelectedIndex == 0)
        {
            uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = 0;
        }
        if (odemetipi.SelectedIndex == 1)
        {
            uygula.Parameters.Add("odemetaksit", System.Data.OleDb.OleDbType.Integer).Value = odemetaksit.Text.ToString();
        }



        uygula.ExecuteNonQuery();
        con.Close();
        Response.Redirect("sayfagoster.aspx?sayfa=dask&MID=" + Session.Contents["UID"]);


    }
    protected void FormView1_PageIndexChanging(object sender, FormViewPageEventArgs e)
    {

    }
    
    protected void InsertButton_Click2(object sender, EventArgs e)
    {
        
    }
    protected void SqlDataSource6_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {
   

    }
    protected void SqlDataSource6_Inserted(object sender, SqlDataSourceStatusEventArgs e)
    {


        OleDbConnection con = new OleDbConnection(ConfigurationManager.ConnectionStrings["acsbagla"].ConnectionString);
        OleDbCommand komutsec = new OleDbCommand("select top 1  *  from tblpolzamangelen order by pid desc", con);


        if (con.State == ConnectionState.Closed)
            con.Open();
        OleDbDataReader oku = komutsec.ExecuteReader();


        while (oku.Read())
        {
            Session.Add("UID", Convert.ToInt32(oku[0].ToString()));

        }
        oku.Close();
        con.Close();
        
                        
        
        //Session.Add("pid", FormView1.DataKeyNames.);
        Response.Redirect("sayfagoster.aspx?sayfa=policevadezaman&pid=" + Session.Contents["UID"]);
    }
    protected void FormView6_ItemInserted(object sender, FormViewInsertedEventArgs e)
    {
       
    }
    protected void FormView6_ItemInserting(object sender, FormViewInsertEventArgs e)
    {
        
    }
}
